package sortPackage;

/**
 * @program: jvm
 * @description
 * @author: tkk fendoukaoziji
 * @create: 2019-03-12 11:15
 **/
public class BubbleSort {
    public static void main(String[] args) {
        int[] arr={12,25,35,4,17,86,35};
        bubbleSort(arr);
        for(int x:arr){
            System.out.print(x+" ");
        }
    }

    private static void bubbleSort(int[] arr) {
        for (int i = 0; i < arr.length -1; i++) {
            for (int j =1; j <arr.length-1-i ; j++) {
                if(arr[j-1]>arr[j]){
                    int temp=arr[j-1];
                    arr[j-1]=arr[j];
                    arr[j]=temp;

            }
            }
        }
    }
}
